package BLC

import (
	"flag"
	"log"
	"os"
)

func (cli *Client) createBlockChainCmd(createBICWithGenesisCmd *flag.FlagSet) {

	flagCreateBlockChainAddress := createBICWithGenesisCmd.String("addr", "", "地址....")

	err := createBICWithGenesisCmd.Parse(os.Args[2:])
	if err != nil {
		log.Panicf("parse cmd of  create  BIC  With  Genesis failed! %v\n ", err)
	}

	// 创建区块
	if createBICWithGenesisCmd.Parsed() {

		if *flagCreateBlockChainAddress == "" {
			PrintUsage()
			os.Exit(1)
		}
		cli.tCreateTelcoWithGenesis(*flagCreateBlockChainAddress)
	}

}

//创建区块链
func (cli *Client) tCreateTelcoWithGenesis(addr string) {
	CreateBlockChainWithGenesisBlock(addr)
}
